home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir36
/
tsbat46.zip
/
DOSTRICK.TXT
< prev
next >
Wrap
Text File
|
1994-09-04
|
10KB
|
252 lines
Assorted MsDos Tricks Sun 4-Sep-94
=====================
All rights reserved
Copyright (c) 1994 by Timo Salmi
..................................................................
Prof. Timo Salmi Co-moderator of comp.archives.msdos.announce
Moderating at garbo.uwasa.fi anonymous FTP archives 128.214.87.1
Faculty of Accounting & Industrial Management; University of Vaasa
Internet: ts@uwasa.fi BBS +(358)-61-3170972; FIN-65101, Finland
..................................................................
┌───────────────────────────────────────────────────────────┐
│ This file belongs to TSBAT*.ZIP. Please do not distribute │
│ this dostrick.txt file separately! │
└───────────────────────────────────────────────────────────┘
You are free to quote brief passages from this file provided you
clearly indicate the source with a proper acknowledgment.
Comments and corrections are solicited. But if you wish to have
individual MsDos usage consultation, please rather post your
question to a UseNet newsgroup like comp.os.msdos.misc. It is much
more efficient than asking me by email. I'd like to help, but I am
very pressed for time. I prefer to pick the questions I answer from
the Usenet news. Thus I can answer publicly at one go if I happen to
have an answer. Besides, newsgroups have a number of readers who
might know a better or an alternative answer. Don't be discouraged,
though, if you get a reply like this from me. I am always glad to
hear from fellow MsDos users.
INDEX
=====
1) Disabling MsDos commands
2) Simulating disk partitioning
3) A config.sys and autoexec.bat example
4) Stepping through config.sys and autoexec.bat command by command
5) Getting rid of "Insert diskette for drive B:"
6) Conditional deleting of files
7) Selected Doskey macro examples
1. Disabling MsDos commands
===========================
You may wish to disable certain MsDos commands for security reasons
to prevent them from being used either accidentally or deliberately.
If you have a command line editor, like doskey, then the disabling
is rather straigtforward. All you have to do is to create a macro
with the same name as the MsDos command. Consider the following
examples. The first example disables the internal MsDos date command
so that the date on your system cannot be changed.
doskey date=rem date has been disabled
The second example disables the format command.
doskey format=rem format has been disabled
Note that since format is an external command, that is it is a
program on your disk, not a command in your command.com command
interpreter, you can still invoke it by giving the explicit path to
it like
c:\dos\format
In fact, since it will be at path, a drive letter will suffice. Of
course it is very easy to ged rid of these redefinitions. In using
doskey, you only have to press alt+F10 to clear the macros.
If you use some other command line editor than doskey then the
commands are naturally slightly different. For example were you to
use CED (garbo.uwasa.fi:/pc/cmdutil/ced10da.zip) the commands would
be
ced syn date echo date has been disabled
Restoring the date command would be
ced clear syn date
2. Simulating disk partitioning
===============================
Since I have more than one PC at my disposal, I have noticed that it
is very useful to have some common standard on them including
similar disk names. For example I always assume that R: is my
ramdisk. Also I usually have my hard disk partitioned so that I have
a pairly fixed usage for C: D: E: and F:. One of the PCs is an ICL
laptop, with a 120Mb disk all on C: with no partitioning. below is
what I have in my autoexec.bat to have the ram disk reference the
way I want and to simulate the disk partitioning. Note the
importance of the order of the substitute commands because of the
double usage of D, since that is where the ram disk _originally_
resides on my ICL configuration.
c:\dos\subst r: d:\
c:\dos\subst d: c:\d
c:\dos\subst e: c:\e
c:\dos\subst f: c:\f
3. A config.sys and autoexec.bat example
========================================
There always is something to learn from looking at the other users'
config.sys and autoexec.bat files. Here are mine from my office 486
with MsDos 5.0. I have added some comments for you.
DEVICE=C:\DOS\SETVER.EXE
DEVICE=C:\DOS\HIMEM.SYS
DOS=UMB
device=c:\dos\emm386.exe /noems /i=e000-efff /x=d200-d600
dos=high
COUNTRY=032,,C:\DOS\COUNTRY.SYS
FILES=30
devicehigh=c:\dos\ramdrive.sys 7000 128 256 /e
rem ZANSI.SYS is from garbo.uwasa.fi:/pc/screen/zansi12.zip
devicehigh=c:\sys\zansi.sys
rem Define a bigger environment size
shell=c:\command.com /p /e:1024
lastdrive=z
@ECHO OFF
rem Description: My normal MsDos 5.0 boot with Scrollit
rem Note below the trick to identify which of my PCs I am using:
set pcid_=karvi
rem Yellow text on black background
echo <ESC>[40;33;1m
PATH C:\DOS;c:\tools;e:\arczip
rem DAILY.EXE is from /pc/ts/tsbat46.bat to run a mini-backup
rem call c:\bat\daily c:\tools\pkzip -u d:\root\root c:\*.*
PROMPT $p$g
rem CHKSUM is from /pc/goldies/chksum16.zip
c:\tools\chksum command.com 49024 io.sys 9850 msdos.sys 5750
loadhigh c:\dos\KEYB SU,,C:\DOS\KEYBOARD.SYS
rem The Command line EDitor is from /pc/goldies/ced.zip
loadhigh c:\tools\ced -B384,128,768,128,128 -Fced.cfg
rem The TSR memory management until is from /pc/memutil/tsrcom35.zip
c:\tools\mark scrollit
rem The screen scrollback buffer is from /pc/screen/scrlit18.zip
loadhigh c:\tools\scrollit /n=myname /k=myid 60
rem The Snipper screen capture is from /pc/goldies/snippr24.zip
loadhigh c:\tools\snipper
rem The cut and paste utility is from /pc/pcmagvol/vol11n07.zip
loadhigh c:\tools\dosclip2
rem The CapsLock fix is from /pc/ts/tstsr20.zip
loadhigh c:\tuki\shftcaps
c:\dos\subst r: j:\
mkdir r:\cmand
copy c:\command.com r:\cmand
c:\dos\attrib +r r:\cmand\command.com
set comspec=r:\cmand\command.com
set temp=r:\cmand
c:\dos\mode con: rate=32 delay=1
rem The clock comparison check is from /pc/ts/tsutil40.zip
c:\tools\dtetimal 1994
r:
4. Stepping through config.sys and autoexec.bat command by command
==================================================================
MsDos 6.0 introduced the possibility of pausing at each line of
config.sys and even selecting if the line is executed. If you press
F8 when your PC is being booted and displays "Starting MS-DOS...",
then "MS-DOS will prompt you to confirm each CONFIG.SYS command". If
you have an earlier MsDos version, you can still put pauses in your
config.sys by utilizing
6333 Jan 23 1993 garbo.uwasa.fi:/pc/sysutil/pausedev.zip
pausedev.zip PAUSE for config.sys (with TP source) D.Murdoch
To step through autoexec.bat you can use the following trick
@echo off
set debug_=true
command1
if "%debug_%" == "true" pause
command2
if "%debug_%" == "true" pause
command3
set debug_=
If you have MsDos 6.0 or later you can use the CHOICE command to
prompt whether you want a command to be executed. If you have an
earlier MsDos version you can use "CHOOSE.EXE Ask questions in batch
files" from the garbo.uwasa.fi:/pc/ts/tsutlf14.zip (or ASK.EXE from
/pc/ts/tsbat46.zip). Below is an outline example
@echo off
set debug_=true
if not "%debug_%" == "true" goto _comm1
CHOOSE /c:yn /n "Execute command1 [Y/N]? "
if not errorlevel==3 if errorlevel==2 goto _next2
:_comm1
command1
:_next2
if not "%debug_%" == "true" goto _comm2
CHOOSE /c:yn /n "Execute command2 [Y/N]? "
if not errorlevel==3 if errorlevel==2 goto _next3
:_comm2
command2
:_next3
(and so on)
set debug_=
5. Getting rid of "Insert diskette for drive B:"
================================================
Q: On my one-floppy-drive PC how can I get rif of the message
"Insert diskette for drive B: and press any key when ready"?
A: The answer is simple as can be. Put the following command into
your AUTOEXEC.BAT file: "SUBST B: A:\". It makes B: point to the one
floppy drive (A:) you have on your system.
6. Conditional deleting of files
================================
This is an improved adaptation of the tip in the PC Computing
Special Issue, 1001 tips, August 1994, pp. 106-232.
If you have MsDos 5+ you can utilize this simple doskey macro to
move files to a trash directory. First ensure that such a directory
exists and if not, mkdir it.
doskey del=if exist $1 copy $1 r:\trash$Tif not exist $1 echo
File $1 not found^G$Tif exist $1 del $1 /p
where all the above is on the SAME line.
You can precede the command with loadhigh to save conventional
memory. I have r: as ramdisk so the trash directory will
automatically be erased when I turn off the computer, or when it
chooses to crash :-).
7. Selected Doskey macro examples
=================================
These examples are given without explanations. They are reasonably
simple and besides you'll learn working them out yourself. Be
slightly careful in experimenting. Make test files to try then on
rather than running them on your existing files.
doskey up=if exist ..\nul cd ..
doskey mv=if exist $2\nul copy $1 $2$Tif exist $2\nul del $1 /p
doskey format=echo Bugger off^G^G^G
(Tip: to format, give the full path. Usually c:\dos\format)
doskey touch=copy $1 + ,,$Tdir $1
doskey where=for %f in (c d e f g h) do dir %f:\$1 /s /p /b
doskey showtime=echo.$Btime$Techo.$Bdate